package com.x25175.file.controller;

import com.x25175.file.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * @author 徐佳辉
 * @date 2020/11/18 14:46
 */
@Controller
public class ViewController {

    @RequestMapping(value = "")
    public String login() {
        return "login";
    }

    @RequestMapping(value = "/student")
    public String student(HttpSession session) {
        User user = (User) session.getAttribute("user");
        if (user == null) {
            return "redirect:";
        }
        return "student";
    }

    @RequestMapping(value = "/register")
    public String register() {
        return "register";
    }

    @RequestMapping(value = "/pwd")
    public String pwd() {
        return "pwd";
    }
    @RequestMapping(value = "/up")
    public String up() {
        return "up";
    }
    @RequestMapping(value = "/picture")
    public String picture() {
        return "picture";
    }

    @RequestMapping(value = "/manage")
    public String m(HttpSession session) {
        User user = (User) session.getAttribute("user");
        if (user == null) {
            return "redirect:";
        }
        return "main";
    }
    @RequestMapping(value = "/edit")
    public String edit(HttpSession session) {
        User user = (User) session.getAttribute("user");
        if (user == null) {
            return "redirect:";
        }
        return "edit";
    }





}
